package tech.lq0.dreamaticdelight.init;

import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;
import tech.lq0.dreamaticdelight.ModUtils;
import tech.lq0.dreamaticvoyage.init.TabRegistry;

import java.util.ArrayList;
import java.util.List;

public class DMDTabs {

    private static final List<RegistryObject<Item>> HIDDEN = new ArrayList<>();

    public static CreativeModeTab DMD_ITEM_TAB = CreativeModeTab.builder()
            .title(Component.translatable("itemGroup.dreamaticdelight_items_tab"))
            .icon(() -> new ItemStack(DMDItems.MOMO_SAUCE.get()))
            .displayItems((param, output) -> DMDItems.ITEMS.getEntries().forEach((registryObject) -> {
                if (!HIDDEN.contains(registryObject)) {
                    output.accept(registryObject.get());
                }
            }))
            .withTabsBefore(TabRegistry.MOD_TAPE_TAB.getId())
            .build();

    public static final DeferredRegister<CreativeModeTab> TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, ModUtils.MOD_ID);

    public static final RegistryObject<CreativeModeTab> ITEM_TAB = TABS.register("dmd_item_tab", () -> DMD_ITEM_TAB);

    public static void register(IEventBus bus) {
        TABS.register(bus);
    }

}
